const outWarehouse = 1;
const inWarehouse = 2;
const count = 3;
const res = await this.ctx.model.Goods.updateOne(
    {
        tenantId: this.ctx.locals.tenantId,
        _id: e.goodsId,
        warehouse: {
            $elemMatch: {
                id: outWarehouse,
                num: { $gte: count },
            },
        },
        // warehouse: {
        //   $not: {
        //     $elemMatch: {
        //       id: inWarehouse,
        //     }
        //   }
        // }
    },
    {
        $inc: {
            'warehouse.$[e1].num': -count,
            'warehouse.$[e2].num': count,
        },
    },
    {
        arrayFilters: [{ 'e1.id': outWarehouse }, { 'e2.id': inWarehouse }],
    }
);
